home *** CD-ROM | disk | FTP | other *** search
- COIL.EXE v2.0 7/25/92 W. D. Kirby
- COIL.EXE v2.1 9/14/93 R. Bryerton
-
- Description:
-
- COIL.EXE is a simple utility to create an endless coil type object for
- the Persistance of Vision (PoV-Ray v1.0) and Polyray v1.6 raytracers.
- COIL.EXE will also export to Connect the Dots and WORM file formats.
- It is set up to create coiled strings of spheres that twist about a
- circle a number of times and terminate at the point of origin. It generates
- a data file to be called from the users main PoV or Polyray input script
- file or as an input file for CTDS or WORM.
-
- Files included:
-
- COIL.EXE DOS executable program v2.1
- COIL.CPP C++ source code for coil.exe v2.1
- COIL.INC Example generated data file of the default coil object
- COIL.POV Example PoV v1.0 main script file that calls COIL.INC
- COIL.PI Example Polyray main script file set up for a default coil
- COIL.MAK MS C++ v8.00 make file for COIL.CPP v2.1
- COIL.DOC This file
-
- COIL_V20.C Origional v2.0 C source code
- COIL_V20.PRJ Origional BC++ v3.1 project file for COIL.C (v2.0)
- COIL_V20.MAK Origional BC++ v3.1 make file for COIL.C (v2.0)
-
- These last 3 files must be renamed from COIL_V20 to COIL in order for
- the respective PRJ and MAK files to function correctly w/the BC++ v3.1
- compiler. I have included these original files because the COIL.EXE v2.1
- program is based upon them. -R. Bryerton 9/14/93
-
-
- Usage:
-
- The COIL program is easy to use since it is interactive. Just type COIL
- at the DOS prompt and enter the parameters required. Most of the questions
- are straight forward. Note that you can hit ENTER to accept the defaults.
-
- There are now more options with version 2.1 in the form of additional
- interactive choices and 4 command line options.
-
- The parameters requested are briefly defined as follows with defaults show
- in brackets:
-
- ------------------------ 'Interactive' options -----------------------------
-
- Output format [POV]: enter the file format for the coil object. Choices
- are PoV-Ray, Polyray, CTDS, and WORM.
-
- Shape type [Sphere]: enter your choice for the object to use in the
- creation of the coil. Choices are sphere, ellipsoid, box, y_cone,and
- y_cylinder. This option is only available for PoV and Polyray formats
- and is accessed through the use of the -e command line option. (see below)
-
- If you choose a shape other than Sphere, COIL will put #declared scale and
- rotate 'vectors' into the .inc file for more options. These vectors apply
- to each object in the coil on an individual basis. (Flatten and stretch
- ellipsoids, for example.)
-
- Output filname [coil.inc]: enter the output file to be created. Note that
- this file does not contain all of the PoV or Polyray inputs required. You
- must #include it into a scene description file. If you chose CTDS or WORM,
- the resulting file will be ready for input into the respective target
- program.
-
- Union name [coil]: name of object union to be used to identify the created
- object. This applies only to PoV and Polyray.
-
- Number of objects [100]: total number of objects used to create the final
- coil object.
-
- Number of objects in cross section [2]: number of objects to be contained
- within the cross section of an imaginary torus about the center position.
- See illustration below. Objects are equally separated in minor angle.
-
- Number of twists [2]: number of twists the coil is to make within a single
- revolution about the center position (i.e., major radius).
-
- Major radius [1.0]: major radius of coil (i.e., center of torus).
-
- Minor radius [0.25]: minor radius of imaginary torus of sphere center
- positions.
-
- Object 'radius' [0.25]: size (radius for spheres) of the individual objects
- that make up coil. The output of other shapes will be appropriately scaled
- to remain consistent with the default sphere scaling.
-
- Overall scale factor [1.0]: scale factor for all x,y,z positions, but not
- the radius (size) of the individual objects.
-
- ------------------------- Command Line options ------------------------------
-
- -d# Display mode Enables a 2D (xy) display of the coil object
- as it is being created. You MUST have a VGA
- display to use this option. Options are...
- 1=640x480 2=800x600 3=1024x768... default is 1
- if -d is specified on the command line with no
- number or an invalid number
- SEE 'VERSION 2.1 NOTES' AT THE END OF THIS
- DOCUMENT FOR **IMPORTANT** INFO ON THIS OPTION
-
- -e Extended menu mode You will be given a choice of shapes to use to
- build the coil object (cones, boxes, etc).
-
- -p# Precision of numbers Default is 6 decimal precision, which should be
- used in output file ok for almost every situation. Valid range is
- 2 to 9. This applies to ALL output formats.
-
- -h HELP Shows a brief summary of program options and
- -help usage
- /? etc...
-
- Note that command line options are just that. You can still enter COIL at
- the command line and the program will run with the default options.
- ----------------------------------------------------------------------------
-
-
-
- + <= 1st sphere center
- object /
- center / minor radius and angle
- + -------------------->+ -------------------
- major radius /
- /
- + <= 2nd sphere center
-
- Illustration of two spheres in cross section
-
-
-
- Source code:
-
- COIL v2.1 was created using Microsoft C++ version 8.0, and is based on the
- original v2.0 C source code by Bill Kirby. The compiled program (COIL.EXE)
- provided will work with an 8088 without a coprocessor or better.
-
- The COIL output has been tested with the Persistance of Vision (PoV)
- raytracer v1.0, Polyray v1.6, CTDS v2.3, and WORM v0.05a.
-
- Testing has included objects containing over 10,000 spheres. The example
- PoV input file (coil.pov & coil.inc ) for a 320x200 image with 100 spheres
- and a plane requires 1 min 50 sec on a 386/387/40 using the 386 protected
- mode version of PoV-Ray v1.0. The equivalent file in Polyray v1.6 takes
- about 2 min 5 sec on the same machine. When rendering primitives other than
- spheres however, Polyray is easily 2x to 4x faster than POV, due to
- Polyray's use of automatic bounds, I'd imagine.
-
- Fragment of code for generation of sphere center positions from coil.c v2.0
-
- /* Compute twisted coil object */
-
- for(i=0;i<steps;++i){ /* loop on number of spheres in object */
- angle1 = 2 * PI * Ntube * (double)i/ (double)steps; /* major angle */
- x1 = cos( angle1 );
- y1 = sin( angle1 );
- angle2 = (double)( Ntwist + 1.0/Ntube) * angle1; /* minor angle */
- x2 = cos( angle2 );
- z2 = sin( angle2);
- xpos = k * ((Rad1 * x1) + (rad2 * x2 * x1)); \
- ypos = k * ((Rad1 * y1) + (rad2 * x2 * y1)); > sphere center position
- zpos = k * rad2 * z2; /
- write_piece(xpos,ypos,zpos,radius); /* sphere position and radius */
- }
-
- Besides computing object positions, the code computes bounds for the
- generated coil using the min and max coil shape x,y,z extent plus a 1% fudge
- factor to insure it encompasses the whole coil. The code is true brute force
- with little optimization. This is justified since the code executes so
- quickly.
-
- Enjoy
-
- Bill Kirby
-
- Bill Kirby CIS [70711,2407], COMART forum
- 3527 Cornell Road
- Fairfax, VA 22030
-
- BBS's visited: You Can Call Me Ray (708) 358-5611
- The Graphics Alternative (510) 524-2780
-
-
- --------------------------NOTES ON VERSION 2.1-------------------------------
-
- You MUST have a VGA display to use the -d option, which will display the
- (approximate) coil object as it is being generated. This allows you to
- experiment with some wild settings without having to render the object to
- see the resulting shape. Please note that, even if you specify a shape other
- than spheres, the graphic preview will show spheres. Also, spheres in the
- preview DO NOT appear evenly spaced due to the Z axis being ignored. You can
- render the included scene file, changing the rotation of the coil to <0 0 0>,
- and compare with the preview using ALL of the default menu choices to get a
- feel for the graphic preview.
-
- >>>>>>>>>>>>>>>>>>>>>>>>>> IMPORTANT INFO <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- DO NOT specify a resolution higher than your MONITOR can handle, as you risk
- the possibility of DAMAGE. If you specify a resolution higher than your
- graphics card is capable of, the program will sense this and disable the
- display while calculating the coil.
-
- If you use the -e command line option, there will be #declared scale and
- rotate 'vectors' included in the data file. These vectors will act on each
- individual object, allowing you to flatten, stretch, or rotate EVERY object
- in the coil on an individual basis.
-
- Note that for POV, if you specify a rotation on more than 1 axis, it
- will not work correctly, although POV won't complain. This is stated in
- the original POV docs, but I have not researched this fact any further.
- Experiment and see what works and what doesn't !!
-
- Polyray WILL handle multiple axis rotations specified in the same vector.
-
-
-
- ------------------------C++ SOURCE CODE NOTES--------------------------------
-
- This program has been rewritten in C++ more as an exercise than out of
- necessity. I would like to thank Bill Kirby, the original author of COIL
- v2.0, for giving me permission to release this update on his code.
-
- I originally wrote the update in C, but then decided to use C++'s object
- oriented environment, although my class implementation is somewhat less
- than optimal. However, adding output formats by deriving classes from the
- base class is VERY simple, as you can see in the C++ source code.
- The only drawback I can see is the file access speed. The equivalent C code
- using fprintf statements writes about 40% faster on my machine than C++
- insertion and extraction operators. I chose to use these operators to
- remain consistant with the rest of the program. Also, speed is not an issue
- with this program, as the 'typical' 100 object coil writes in less than a
- second on most machines.
- Note that this version of the program will only compile with the MS C++
- 8.00 compiler or higher due to the use of MS specific functions. I will try
- to make the code 'portable' in the next few months if anyone is interested.
- I am a beginner in C++ and would appreciate any observations you should
- happen to make.
-
- Any questions, comments, or otherwise are welcome.
-
- Rob Bryerton CIS [73747,433] GRAPHDEV
- 7/14/93
-
- BBS's visited: You Can Call Me Ray (708) 358-5611